﻿// 1.1.3.12. Write a boolean expression that returns if the bit at position p (counting from 0) in a given
// integer number has value of 1. Example: v=5; p=1  false.

using System;

class IsTheBitOne
{
    static void Main()
    {
        while (true)
        {
            Console.Write("Please enter integer number: ");
            int number = int.Parse(Console.ReadLine());
            Console.Write("Please enter position of the bit you want to check its value: ");
            byte positionBit = byte.Parse(Console.ReadLine());
            bool isTheBitOne = ((number >> (positionBit)) & 1) == 1;
            Console.WriteLine("The bit {0} in the number {1} is 1: {2}", positionBit, number, isTheBitOne);
        }
    }
}
